package cn.wei.srb.core.controller.api;

import cn.wei.common.result.R;
import cn.wei.srb.core.pojo.entity.Dict;
import cn.wei.srb.core.service.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 韦
 * @Date: 2021/07/22/20:14
 */
@Api(tags = "数据字典")
@RestController
@Slf4j
@RequestMapping("/api/core/dict")
public class DictController {

    @Resource
    private DictService dictService;
    @ApiOperation("获取该节点编码下的所有子节点")
    @GetMapping("/findByDictCode/{dictCode}")
    public R findByDictCode(
            @ApiParam(value = "节点编码",required = true)
            @PathVariable String dictCode
    ){

        List<Dict> dictList = dictService.findByDictCode(dictCode);
        return R.ok().data("list",dictList);
    }

}
